<template>
	<view>
		<view class="question-content" v-for="item in questionList" :key='item.question_id' @click="howToEnter(item)" v-if="item.status ==1 && questionList.length!=0">
			<view class="">{{item.title}}？</view>
			<image :src="imglink + 'home/arrow-right.png'" mode=""></image>
		</view>
		<view v-if="questionList.length==0" class="no-question">
			暂无常见问题！
		</view>
		<!-- <view class="question-content">
			<view class="">如何绑定收款银行卡？</view>
			<image :src="imglink + 'home/arrow-right.png'" mode=""></image>
		</view>
		<view class="question-content">
			<view class="">如何发起拼团？</view>
			<image :src="imglink + 'home/arrow-right.png'" mode=""></image>
		</view> -->
	</view>
</template>

<script>
	export default{
		data(){
			return {
				imglink: this.$store.state.imgLink,
				questionList:[],
				store_id:""
			}
		},
		onLoad(options) {
			let store_id = parseInt(options.store_id,10);
			console.log('进入了onload 获取url的store_id',store_id)
			if(!store_id > 0){
				store_id = uni.getStorageSync('store_id')?parseInt(uni.getStorageSync('store_id'),10):0
			}else{
				uni.setStorageSync('store_id', store_id)
			}
			
			this.store_id = parseInt(store_id,10)
			this.$store.commit('updateStoreId',store_id)
			this.getList()
			
		},
		methods:{
			howToEnter(item){
				uni.setStorageSync('question',item)
				uni.navigateTo({
					url:'enter/enter?store_id=' + this.store_id
				})
			},
			// 获取问题列表
			getList(){
				let data = {
					token:this.$store.getters.getToken,
				}
				this.$api.get_question_list(data).then( res => {
					console.log(res)
					if(res.status){
						this.questionList = res.list.data
						// console.log('地址列表11111',this.orderList)
					}
				}).catch( err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style>
	page{
		background: #F3F3F4;
	}
	.no-question{
		color: #999999;
		font-size: 28upx;
		position: fixed;
		top: 50%;left: 50%;
		transform: translate(-50%,-50%);
		text-align: center;
	}
	.question-content{
		width: 100%;
		height: 100upx;
		padding: 0 30upx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		margin-bottom: 20upx;
		background: #FFFFFF;
	}
	.question-content>view{
		color: #666666;
		font-size: 28upx;
		line-height: 100upx;
	}
	.question-content>image{
		width: 20upx;
		height: 26upx;
		margin-top: 36upx;
	}
</style>
